INSTALL        = @INSTALL@
etcdir         = $(DESTDIR)@prefix@/etc
bindir         = $(DESTDIR)@prefix@/bin

all:
clean:
check:

install:
	$(INSTALL) README.txt $(DESTDIR)@prefix@
	$(INSTALL) ../LICENSE $(DESTDIR)@prefix@
	@mkdir -p $(etcdir) $(DESTDIR)@prefix@/logs
	$(INSTALL) config.ini.sample $(etcdir)/
	$(INSTALL) wise.ini.sample $(etcdir)/
	$(INSTALL) cont3xt.ini.sample $(etcdir)/
	$(INSTALL) parliament.ini.sample $(etcdir)/
	$(INSTALL) parliament.env.example $(etcdir)/
	$(INSTALL) env.example $(etcdir)/

	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkimecont3xt.systemd.service > $(etcdir)/arkimecont3xt.systemd.service
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkimecapture.systemd.service > $(etcdir)/arkimecapture.systemd.service
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkimeviewer.systemd.service > $(etcdir)/arkimeviewer.systemd.service
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkimewise.systemd.service > $(etcdir)/arkimewise.systemd.service
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkimeparliament.systemd.service > $(etcdir)/arkimeparliament.systemd.service

	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkime_update_geo.sh > $(bindir)/arkime_update_geo.sh
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkime_add_user.sh > $(bindir)/arkime_add_user.sh
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkime_config_interfaces.sh > $(bindir)/arkime_config_interfaces.sh
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < Configure > $(bindir)/Configure
	chmod 0755 $(bindir)/arkime_update_geo.sh $(bindir)/arkime_add_user.sh $(bindir)/Configure $(bindir)/arkime_config_interfaces.sh
	/usr/bin/env bash ./afterinstall.sh

installmoloch:
	rm -f $(etcdir)/arkime*
	rm -f $(bindir)/arkime*
	$(INSTALL) README.txt @prefix@
	$(INSTALL) ../LICENSE @prefix@
	@mkdir -p $(etcdir) @prefix@/logs
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkime_update_geo.sh > $(bindir)/moloch_update_geo.sh
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < arkime_add_user.sh > $(bindir)/moloch_add_user.sh
	sed -e "s,BUILD_ARKIME_INSTALL_DIR,@prefix@,g" < Configure.moloch > $(bindir)/Configure
	chmod 0755 $(bindir)/moloch_update_geo.sh $(bindir)/moloch_add_user.sh $(bindir)/Configure
